##cmake_minimum_required( VERSION 2.8 )
project("tscore")
find_package( Qt4 REQUIRED )
include( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES(
    ${QT_INCLUDE_DIR}
    ${QT_QTSQL_INCLUDE_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}
    interfaces
)

# генерируем деф файл
#check_include_file_cxx("src/def.h" HAVE_DEF)
set(INSTPREF ${CMAKE_INSTALL_PREFIX})
configure_file(src/def.h.in def.h)



set( tscore_H
        src/tslog.h
        src/tsiniter.h
        src/mainwin.h
)

set( tscore_SRCS
	src/main.cpp
       	src/tslog.cpp 
        src/tsiniter.cpp
        src/mainwin.cpp
)
set( UIS
    src/mainwin.ui
)

qt4_wrap_ui(UIS_H ${UIS})

qt4_wrap_cpp( MOC_SOURCES ${tscore_H} )

add_executable( tscore ${tscore_SRCS} ${MOC_SOURCES} ${UIS_H})

target_link_libraries( tscore ${QT_LIBRARIES} ${QT_QTSQL_LIBRARIES})

# install for linux
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
set(tsdir ${CMAKE_INSTALL_PREFIX})
set(tsdir_bin ${tsdir}/bin)
install(TARGETS tscore DESTINATION ${tsdir_bin})
install(FILES files/tscore.conf
DESTINATION ${tsdir}/etc )
install(FILES files/torisakura_splash_logo.png DESTINATION ${tsdir}/share/pixmaps)
install(FILES files/torisakura_login_logo.png DESTINATION ${tsdir}/share/pixmaps)

endif()

#for mac and windows not install. cpack.


